<html>
<head>
  <title>21-事务隔离级别和MVCC</title>
  <basefont face="微软雅黑" size="2" />
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  <meta name="exporter-version" content="YXBJ Windows/600646 (zh-CN, DDL); Windows/6.1.1 (Win64);"/>
  <meta name="content-class" content="yinxiang.markdown"/>
  <style>
    body, td {
      font-family: 微软雅黑;
      font-size: 10pt;
    }
  </style>
</head>
<body>
<a name="1087"/>
<h1>21-事务隔离级别和MVCC</h1>

<div><span><div style="font-size: 14px; margin: 0; padding: 0; width: 100%;"><h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">事前准备</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><img src="21-事务隔离级别和MVCC_files/Image.png" type="image/png" data-filename="Image.png"/></p>
<h2 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 34px; border-bottom: 1px solid #dbdbdb; color: #333;">1 事务隔离级别</h2>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">MySQL是一个客户端/服务器架构的软件，对于同一个服务器来说，可以有若干个客户端与之连接，每个客户端与服务器连接上之后，就可以称之为一个会话（session）。每个客户端都可以在自己的会话中向服务器发出请求语句，一个请求语句可能是某个事务的一部分，也就是对于服务器来说可能同时处理多个事务。在事务简介的章节中说过事务有一个称之为<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">隔离性</strong>的特性，理论上在某个事务对某个数据进行访问时，其他事务应该进行排队，当该事务提交之后，其他事务才可以继续访问这个数据。但是这样对性能影响太大，我们既想保持事务的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">隔离性</strong>，又想让服务器在处理访问同一数据的多个事务性能尽可能高些。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">1-1 SQL标准中事务并发执行遇到的问题</h3>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">脏写（Dirty Write）</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">如果<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">一个事务修改了另一个未提交事务修改过的数据</strong>，那就意味着发生了<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">脏写</strong>，示意图如下：<br/>
<img src="21-事务隔离级别和MVCC_files/1.jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">如上图，Session A和Session B各开启了一个事务，Session B中的事务先将number列为1的记录的name列更新为'关羽'，然后Session A中的事务接着又把这条number列为1的记录的name列更新为张飞。如果之后Session B中的事务进行了回滚，那么Session A中的更新也将不复存在，这种现象就称之为脏写。这时Session A中的事务就很懵逼，我明明把数据更新了，最后也提交事务了，怎么到最后说自己啥也没干呢？</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">脏读（Dirty Read）</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">如果<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">一个事务读到了另一个未提交事务修改过的数据</strong>，那就意味着发生了<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">脏读</strong>，示意图如下：</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">如上图，Session A和Session B各开启了一个事务，Session B中的事务先将number列为1的记录的name列更新为'关羽'，然后Session A中的事务再去查询这条number为1的记录，如果du到列name的值为'关羽'，而Session B中的事务稍后进行了回滚，那么Session A中的事务相当于读到了一个不存在的数据，这种现象就称之为脏读。</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">不可重复读（Non-Repeatable Read）</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">如果<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">一个事务只能读到另一个已经提交的事务修改过的数据，并且其他事务每对该数据进行一次修改并提交后，该事务都能查询到最新值</strong>，那就意味着发生了<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">不可重复度</strong>，示意图如下：<br/>
<img src="21-事务隔离级别和MVCC_files/1 [1].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">如上图，我们在Session B中提交了几个隐式事务（注意是隐式事务，意味着语句结束事务就提交了），这些事务都修改了number列为1的记录的列name的值，每次事务提交之后，如果Session A中的事务都可以查看到最新的值，这种现象也被称之为不可重复读。</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">幻读（Phantom）</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">如果<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">一个事务先根据某些查询条件查询出一些记录，之后另一个事务又向表中插入了符合这些条件的记录，原先的事务再次按照该条件查询时，能把另一个事务插入的记录也读出来</strong>，那就意味着发生了<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">幻读</strong>，示意图如下：<img src="21-事务隔离级别和MVCC_files/1 [2].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">如上图，Session A中的事务先根据条件number &gt; 0这个条件查询表hero，得到了name列值为'刘备'的记录；之后Session B中提交了一个隐式事务，该事务向表hero中插入了一条新记录；之后Session A中的事务再根据相同的条件number &gt; 0查询表hero，得到的结果集中包含Session B中的事务新插入的那条记录，这种现象也被称之为幻读。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">在MySQL官方文档中，幻读的定义是：<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">同一个事务中，相同检索条件的多次查询操作，返回的记录的结果集不同，即为幻读。那么实际上对于insert、delete、update等写操作，也是读的一种特殊形式（定位需要写的记录的过程本质是读取）；</strong></p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">1-2 SQL标准中的四种隔离级别</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">上边介绍了几种并发事务执行过程中可能遇到的一些问题，这些问题也有轻重缓急之分，我们给这些问题按照严重性来排一下序：</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">脏写 &gt; 脏读 &gt; 不可重复度 &gt; 幻读</strong></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">上边所说的舍弃一部分隔离性来换取一部分性能在这里就体现在：<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">设立一些隔离级别，隔离级别越低，越严重的问题就越可能发生</strong>。有一帮人（并不是设计MySQL的大叔们）制定了一个所谓的S<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">QL标准</strong>，在标准中设立了4个<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">隔离级别</strong>：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Read Uncommitted</strong>：读未提交</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Read Committed</strong>：读已提交</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Repeatable Read</strong>：可重复读</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Serializable</strong>：可串行化</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">SQL标准</strong>中规定，针对不同的隔离级别，并发事务<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">可以发生</strong>不同严重程度的问题，具体情况如下：<br/>
<img src="21-事务隔离级别和MVCC_files/Image [1].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">也就是说：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Read Uncommitted</strong>隔离级别下，可能发生<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">脏读、不可重复读</strong>和<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">幻读</strong>问题；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Read Committed</strong>隔离级别下，可能发生<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">不可重复读</strong>和<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">幻读</strong>，但是不可以发生<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">脏读</strong>问题；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Repeatable Read</strong>隔离级别下，可能发生<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">幻读</strong>问题，但是不可以发生<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">脏读</strong>和<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">不可重复度</strong>问题；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Serializable</strong>隔离级别下，各种问题都不可以发生。</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">对于<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">脏写</strong>，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">因为脏写是个非常严重的问题，无论是哪种隔离级别，都不允许脏写的情况发生</strong>。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">1-3 MySQL中支持的四种隔离级别</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">不同的数据库厂商对SQL标准中规定的四种隔离级别支持不一样，比方说Oracle就只支持Read Committed和Serializable隔离级别。本书中所讨论的MySQL虽然支持4种隔离级别，但与SQL标准中所规定的各级隔离级别允许发生的问题却有些出入，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">MySQL在Repeatable Read隔离级别下，是可以禁止幻读问题的发生的</strong>。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">MySQL</strong>的默认隔离级别为<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Repeatable Read</strong>。</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">如何设置事务的隔离级别</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">可以通过下面语句修改事务的隔离级别：<br/>
<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">SET [ GLOBAL | SESSION ] TRANSACTION ISOLATION LEVEL level；</strong></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">其中的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">level</strong>可选值有4个：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">READ UNCOMMITTED</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">READ COMMITTED</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">REPEATABLE READ</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">SERIALIZABLE</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">设置事务的隔离级别语句中，在<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">SET</strong>关键字后可以放置<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">GLOBAL</strong>关键字、<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">SESSION</strong>关键字或者什么都不放，这样会对不同范围的事务产生不同的影响，具体如下：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">使用<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">GLOBAL</strong>关键字（在<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">全局</strong>范围影响）：<br/>
<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">SET GLOBAL TRANSACTION ISOLATION LEVEL SERIALIZABLE；</strong><br/>
则：<br/>
a. 只对执行完该语句之后产生的会话起作用；<br/>
b. 对当前已经存在的会话无效。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">使用<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">SESSION</strong>关键字（在<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">会话</strong>范围影响）：<br/>
<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE；</strong><br/>
a. 对当前会话的所有后续的事务有效；<br/>
b. 该语句可以在已经开启的事务中执行，但不会影响当前正在执行的事务。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">上述两个关键字都不用（只对执行语句后的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">下一个事务</strong>产生影响）：<br/>
<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">SET TRANSACTION ISOLATION LEVEL SERIALIZABLE；</strong><br/>
a. 只对当前会话中下一个即将开启的事务有效；<br/>
b. 下一个事务执行完后，后续事务将恢复到之前的隔离级别；<br/>
c. 该语句不能在已经开启的事务中执行，会报错。</p>
</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">如果在服务器启动时想改变事务的默认隔离级别，可以修改<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">启动参数transaction-isolation</strong>的值，比方说在启动服务器时指定了--transaction-isolation=SERIALIZABLE，那么事务的默认隔离级别就从原来的REPEATABLE READ变成了SERIALIZABLE。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">想要查看当前会话默认的隔离级别可以通过查看<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">系统变量transaction_isolation</strong>的值来确定：<br/>
<img src="21-事务隔离级别和MVCC_files/Image [2].png" type="image/png" data-filename="Image.png"/><br/>
<img src="21-事务隔离级别和MVCC_files/Image [3].png" type="image/png" data-filename="Image.png"/></p>
<h2 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 34px; border-bottom: 1px solid #dbdbdb; color: #333;">2 MVCC原理</h2>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">MVCC，全名：Multi-Version Concurrency Control，中文名：多版本并发控制</strong></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">多版本并发控制（Multi-Version Concurrency Control, MVCC）是 MySQL 的 InnoDB 存储引擎实现<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Read Committed和Repeatable Read</strong>隔离级别的一种具体方式，用于实现提交读和可重复读这两种隔离级别。而未提交读隔离级别总是读取最新的数据行，无需使用 MVCC。可串行化隔离级别需要对所有读取的行都加锁，单纯使用 MVCC 无法实现。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">2-1 版本链</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">前边说过，对于使用InnoDB存储引擎的表来说，它的聚簇索引记录中都包含两个必要的隐藏列（row_id并不是必要的，我们创建的表中有主键或者非NULL的UNIQUE键时都不会包含row_id列）：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">trx_id</strong>：每次一个事务对某条聚簇索引记录进行改动时，都会把该书屋的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">事务id</strong>赋值给<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">trx_id</strong>隐藏列；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">roll_pointer</strong>：每次对某条聚簇索引记录进行改动时，都会把旧的版本写入到<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">undo日志</strong>中，然后这个隐藏列就相当于一个指针，可以通过它来找到该记录修改前的信息。</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">比方说表hero现在只包含一条记录：<br/>
<img src="21-事务隔离级别和MVCC_files/Image [4].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">假设插入该记录的事务id为80，那么此刻该条记录的示意图如下所示：<br/>
<img src="21-事务隔离级别和MVCC_files/1 [3].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><img src="21-事务隔离级别和MVCC_files/Image [5].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">假设之后两个事务id分别为100、200的事务对这条记录进行UPDATE操作，操作流程如下：<br/>
<img src="21-事务隔离级别和MVCC_files/1 [4].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">每次对记录进行改动，都会记录一条<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">undo日志</strong>，每条undo日志也都有一个roll_pointer属性（INSERT操作对应的undo日志没有该属性，因为该记录并没有更早的版本），可以将这些undo日志都连起来，串成一个链表，所以现在的情况就像下图一样：<br/>
<img src="21-事务隔离级别和MVCC_files/1 [5].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">对该记录每次更新后，都会将旧值放到一条undo日志中，就算是该记录的一个旧版本，随着更新次数的增多，所有的版本都会被<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">roll_pointer属性</strong>连接成一个<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">链表</strong>，我们把<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">这个链表</strong>称之为<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">版本链</strong>，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">版本链的头节点就是当前记录最新的值</strong>。另外，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">每个版本中还包含生成该版本时对应的事务id，这个信息很重要</strong>。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">2-2 ReadView</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">对于使用<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">READ UNCOMMITTED</strong>隔离级别的事务来说，由于可以读到未提交事务修改过的记录，所以直接读取记录的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">最新版本</strong>就好了；对于使用<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">SERIALIZABLE</strong>隔离级别的事务来说，InnoDB规定使用<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">加锁的方式来访问记录</strong>（加锁是啥我们后续文章中说哈）；对于使用<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">READ COMMITTED和REPEATABLE READ</strong>隔离级别的事务来说，都必须保证读到已经提交了的事务修改过的记录，也就是说假如另一个事务已经修改了记录但是尚未提交，是不能直接读取最新版本的记录的，核心问题就是：<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">需要判断一下版本链中的哪个版本是当前事务可见的</strong>。为此，InnoDB提出了一个ReadView的概念，这个ReadView中主要包含4个比较重要的内容：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">m_ids</strong>：表示在生成<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ReadView</strong>时当前系统中活跃的读写事务的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">事务id</strong>列表；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">min_trx_id</strong>：表示在生成<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ReadView</strong>时当前系统中活跃的读写事务中最小的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">事务id</strong>，也就是m_ids的最小值；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">max_trx_id</strong>：表示在生成<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ReadView</strong>时系统中应该分配给下一个事务的id值；</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><img src="21-事务隔离级别和MVCC_files/Image [6].png" type="image/png" data-filename="Image.png"/></p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">creator_trx_id</strong>：表示生成该<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ReadView</strong>的事务的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">事务id</strong>。</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><img src="21-事务隔离级别和MVCC_files/Image [7].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">有了这个ReadView，这样在访问某条记录时，只需要按照下边的步骤判断记录的某个版本是否可见：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">如果被访问版本的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">trx_id</strong>属性值与<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ReadView</strong>中的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">creator_trx_id</strong>值相同，意味着当前事务在访问自己修改过的记录，所以该版本可以被当前事务访问；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">如果被访问版本的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">trx_id</strong>属性值小于<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ReadView</strong>中的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">min_trx_id</strong>值，表明生成该版本的事务在当前事务生成<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ReadView</strong>前已经提交，所以该版本可以被当前事务访问；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">如果被访问版本的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">trx_id</strong>属性值大于<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ReadView</strong>中的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">max_trx_id</strong>值，表明生成该版本的事务在当前事务生成<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ReadView</strong>后才开启，所以该版本不可以被当前事务访问；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">如果被访问版本的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">trx_id</strong>属性值在<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ReadView</strong>的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">min_trx_id</strong>和<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">max_trx_id</strong>之间，那需要判断一下<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">trx_id</strong>属性值是不是在<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">m_ids</strong>列表中，如果在，说明创建<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ReadView</strong>时生成该版本的事务还是活跃的，该版本不可以被访问；如果不在，说明创建<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ReadView</strong>时生成该版本的事务已经被提交，该版本可以被访问。</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">如果某个版本的数据对当前事务不可见的话，那就顺着版本链找到下一个版本的数据，继续按照上边的步骤判断可见性，依此类推，直到版本链中的最后一个版本。如果最后一个版本也不可见的话，那么就意味着该条记录对该事务完全不可见，查询结果就不包含该记录。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">在MySQL中，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Read Committed</strong>和<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Repeatable Read</strong>隔离级别的的一个非常大的区别就是<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">它们生成ReadView的时机不同</strong>。还是以表hero为例来，假设现在表hero中只有一条由事务id为80的事务插入的一条记录：<br/>
<img src="21-事务隔离级别和MVCC_files/Image [8].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">接下来看一下READ COMMITTED和REPEATABLE READ所谓的生成ReadView的时机不同到底不同在哪里。</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">2-2-1 Read Committed 每次读取数据前都生成一个ReadView</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">比方说现在系统里有两个事务id分别为100、200的事务在执行：<br/>
<img src="21-事务隔离级别和MVCC_files/Image [9].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">此刻，表hero中number为1的记录得到的版本链表如下所示：<br/>
<img src="21-事务隔离级别和MVCC_files/1 [6].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">假设现在有一个使用<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">READ COMMITTED</strong>隔离级别的事务开始执行：<br/>
<img src="21-事务隔离级别和MVCC_files/Image [10].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这个SELECT1的执行过程如下：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">在执行SELECT语句时会先生成一个ReadView，ReadView的m_ids列表的内容就是[100, 200]，min_trx_id为100，max_trx_id为201，creator_trx_id为0；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">然后从版本链中挑选可见的记录，从图中可以看出，最新版本的列name的内容是'张飞'，该版本的trx_id值为100，在m_ids列表内，所以不符合可见性要求，根据roll_pointer跳到下一个版本；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">下一个版本的列name的内容是'关羽'，该版本的trx_id值也为100，也在m_ids列表内，所以也不符合要求，继续跳到下一个版本；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">下一个版本的列name的内容是'刘备'，该版本的trx_id值为80，小于ReadView中的min_trx_id值100，所以这个版本是符合要求的，最后返回给用户的版本就是这条列name为'刘备'的记录；</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">之后，我们把事务id为100的事务提交一下，就像这样：<img src="21-事务隔离级别和MVCC_files/Image [11].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">然后再到事务id为200的事务中更新一下表hero中number为1的记录：<img src="21-事务隔离级别和MVCC_files/Image [12].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">此刻，表hero中number为1的记录的版本链就长这样：<br/>
<img src="21-事务隔离级别和MVCC_files/1 [7].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">然后再到刚才使用READ COMMITTED隔离级别的事务中继续查找这个number为1的记录，如下：<br/>
<img src="21-事务隔离级别和MVCC_files/Image [13].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这个SELECT2的执行过程如下：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">在执行SELECT语句时会<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">又会单独生成</strong>一个ReadView，该ReadView的m_ids列表的内容就是[200]（事务id为100的那个事务已经提交了，所以再次生成快照时就没有它了），min_trx_id为200，max_trx_id为201，creator_trx_id为0；’</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">然后从版本链中挑选可见的记录，从图中可以看出，最新版本的列name的内容是'诸葛亮'，该版本的trx_id值为200，在m_ids列表内，所以不符合可见性要求，根据roll_pointer跳到下一个版本；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">下一个版本的列name的内容是'赵云'，该版本的trx_id值为200，也在m_ids列表内，所以也不符合要求，继续跳到下一个版本；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">下一个版本的列name的内容是'张飞'，该版本的trx_id值为100，小于ReadView中的min_trx_id值200，所以这个版本是符合要求的，最后返回给用户的版本就是这条列name为'张飞'的记录；</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">以此类推，如果之后事务id为200的记录也提交了，再此在使用READ COMMITTED隔离级别的事务中查询表hero中number值为1的记录时，得到的结果就是'诸葛亮'了，具体流程我们就不分析了。总结一下就是：<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">使用READ COMMITTED隔离级别的事务在每次查询开始时都会生成一个独立的ReadView</strong>。</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">2-2-1 Repeatable Read 在第一次读取数据时生成一个ReadView</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">对于使用REPEATABLE READ隔离级别的事务来说，只会在第一次执行查询语句时生成一个ReadView，之后的查询就不会重复生成了</strong>。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">比方说现在系统里有两个事务id分别为100、200的事务在执行：<br/>
<img src="21-事务隔离级别和MVCC_files/Image [14].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">此刻，表hero中number为1的记录得到的版本链表如下所示：<br/>
<img src="21-事务隔离级别和MVCC_files/1 [8].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">假设现在有一个使用<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">REPEATABLE READ</strong>隔离级别的事务开始执行：<br/>
<img src="21-事务隔离级别和MVCC_files/Image [15].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这个SELECT1的执行过程如下：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">在执行SELECT语句时会先生成一个ReadView，ReadView的m_ids列表的内容就是[100, 200]，min_trx_id为100，max_trx_id为201，creator_trx_id为0；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">然后从版本链中挑选可见的记录，从图中可以看出，最新版本的列name的内容是'张飞'，该版本的trx_id值为100，在m_ids列表内，所以不符合可见性要求，根据roll_pointer跳到下一个版本；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">下一个版本的列name的内容是'关羽'，该版本的trx_id值也为100，也在m_ids列表内，所以也不符合要求，继续跳到下一个版本；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">下一个版本的列name的内容是'刘备'，该版本的trx_id值为80，小于ReadView中的min_trx_id值100，所以这个版本是符合要求的，最后返回给用户的版本就是这条列name为'刘备'的记录；</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">之后，我们把事务id为100的事务提交一下，就像这样：<br/>
<img src="21-事务隔离级别和MVCC_files/Image [16].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">然后再到事务id为200的事务中更新一下表hero中number为1的记录：<br/>
<img src="21-事务隔离级别和MVCC_files/Image [17].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">此刻，表hero中number为1的记录的版本链就长这样：<br/>
<img src="21-事务隔离级别和MVCC_files/1 [9].jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">然后再到刚才使用REPEATABLE READ隔离级别的事务中继续查找这个number为1的记录，如下：<br/>
<img src="21-事务隔离级别和MVCC_files/Image [18].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这个SELECT2的执行过程如下：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">因为当前事务的隔离级别为REPEATABLE READ，而之前在执行SELECT1时已经生成过ReadView了，所以此时直接复用之前的ReadView，之前的ReadView的m_ids列表的内容就是[100, 200]，min_trx_id为100，max_trx_id为201，creator_trx_id为0；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">然后从版本链中挑选可见的记录，从图中可以看出，最新版本的列name的内容是'诸葛亮'，该版本的trx_id值为200，在m_ids列表内，所以不符合可见性要求，根据roll_pointer跳到下一个版本；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">下一个版本的列name的内容是'赵云'，该版本的trx_id值为200，也在m_ids列表内，所以也不符合要求，继续跳到下一个版本；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">下一个版本的列name的内容是'张飞'，该版本的trx_id值为100，而m_ids列表中是包含值为100的事务id的，所以该版本也不符合要求，同理下一个列name的内容是'关羽'的版本也不符合要求。继续跳到下一个版本；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">下一个版本的列name的内容是'刘备'，该版本的trx_id值为80，小于ReadView中的min_trx_id值100，所以这个版本是符合要求的，最后返回给用户的版本就是这条列c为'刘备'的记录；</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">也就是说两次SELECT查询得到的结果是重复的，记录的列c值都是'刘备'，这就是<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">可重复读</strong>的含义。如果我们之后再把事务id为200的记录提交了，然后再到刚才使用REPEATABLE READ隔离级别的事务中继续查找这个number为1的记录，得到的结果还是'刘备'，具体执行过程大家可以自己分析一下。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">2-3 MVCC小结</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">从上边的描述可以看出，MySQL中<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">MVCC，Multi-Version Concurrency Control ，多版本并发控制</strong>实现原理如下：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">read uncommitted：读取版本链中最新的数据；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">read committed：通过版本链和ReadView找到可读版本；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">repeatable read：通过版本链和ReadView找到可读版本；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">serializable：通过锁机制实现串行化。</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">read committed、repeatable read这两个隔离级别的一个很大不同就是：生成ReadView的时机不同。</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">read committed在每一次进行普通select操作前都会生成一个ReadView；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">repeatable read只在第一次进行普通SELECT操作前生成一个ReadView，之后的查询操作都重复使用这个ReadView就好了。</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><img src="21-事务隔离级别和MVCC_files/Image [19].png" type="image/png" data-filename="Image.png"/></p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">2-4 关于purge</h3>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">insert undo在事务提交之后就可以被释放掉了，而update undo由于还需要支持MVCC，不能立即删除掉；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">为了支持MVCC，对于delete mark操作来说，仅仅是在记录上打一个删除标记，并没有真正将它删除掉；</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">随着系统的运行，在确定系统中包含最早产生的那个ReadView的事务不会再访问某些update undo日志以及被打了删除标记的记录后，有一个后台运行的purge线程会把它们真正的删除掉。</p>
<h2 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 34px; border-bottom: 1px solid #dbdbdb; color: #333;">3 MVCC衍生常见问题</h2>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">为什么select count(*)在myisam表上很快，而在InnoDB的表上很慢？</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">因为innodb采用了MVCC技术,对于相同的行,可能同时存在多个版本,innodb必须根据查询的时间来过滤掉一些行,才能得出结果,必然要执行全表扫描,而全表扫描是非常耗时的.对于myisam的表,任何行都只有一个版本,mysql甚至不需要扫描就可以直接返回精确的统计结果,我们用explain也可以看到,对于myisam的表,执行select count(*)的时候,mysql显示” Select tables optimized away”,查询直接被优化了;而对于innodb的表,可能是全表扫描,也可能是”using index”,总之,速度肯定会比myisam的表慢很多.</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">数据库只是频繁更新,没有插入新数据,但是为什么表空间占用会越来越大?</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">如果在数据库中执行了大事务, innodb就会把被修改数据的前映像存放到称为回滚段的公共表空间中,而且对于索引和表中的行的多个版本,如果innodb来不及purge,或者这些行因为要提供一致读而不能被purge,就会占用越来越多的空间,甚至有可能短时间撑爆你的硬盘.所以应用程序中需要合理控制事务的大小.</p>
<h4 style="line-height: 160%; box-sizing: content-box; font-size: 20px; color: #333;">何时使用char类型,何时使用varchar类型的列?</h4>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">在使用myisam引擎的情况下,定长表虽然可能占用较多的存储空间,但是它会加快检索和全表扫描的速度,此时适合选用char的列,而对于表中的变长的列,可以采用分表的方法把变长的列拆分出去,提高定长表的检索性能.而如果使用的是innodb的引擎,由于innodb的mvcc策略的实施,char数据类型相对于varchar类型几乎没有任何优势,反而varchar列可能节省更多的存储空间,建议使用varchar数据类型.</p>
</div><center style="display:none !important;visibility:collapse !important;height:0 !important;white-space:nowrap;width:100%;overfl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-resource%3A%2F%2Fdatabase%2F1091%3A1)%0A%0A%E5%A6%82%E4%B8%8A%E5%9B%BE%EF%BC%8CSession%20A%E5%92%8CSession%20B%E5%90%84%E5%BC%80%E5%90%AF%E4%BA%86%E4%B8%80%E4%B8%AA%E4%BA%8B%E5%8A%A1%EF%BC%8CSession%20B%E4%B8%AD%E7%9A%84%E4%BA%8B%E5%8A%A1%E5%85%88%E5%B0%86number%E5%88%97%E4%B8%BA1%E7%9A%84%E8%AE%B0%E5%BD%95%E7%9A%84name%E5%88%97%E6%9B%B4%E6%96%B0%E4%B8%BA'%E5%85%B3%E7%BE%BD'%EF%BC%8C%E7%84%B6%E5%90%8ESession%20A%E4%B8%AD%E7%9A%84%E4%BA%8B%E5%8A%A1%E6%8E%A5%E7%9D%80%E5%8F%88%E6%8A%8A%E8%BF%99%E6%9D%A1number%E5%88%97%E4%B8%BA1%E7%9A%84%E8%AE%B0%E5%BD%95%E7%9A%84name%E5%88%97%E6%9B%B4%E6%96%B0%E4%B8%BA%E5%BC%A0%E9%A3%9E%E3%80%82%E5%A6%82%E6%9E%9C%E4%B9%8B%E5%90%8ESession%20B%E4%B8%AD%E7%9A%84%E4%BA%8B%E5%8A%A1%E8%BF%9B%E8%A1%8C%E4%BA%86%E5%9B%9E%E6%BB%9A%EF%BC%8C%E9%82%A3%E4%B9%88Session%20A%E4%B8%AD%E7%9A%84%E6%9B%B4%E6%96%B0%E4%B9%9F%E5%B0%86%E4%B8%8D%E5%A4%8D%E5%AD%98%E5%9C%A8%EF%BC%8C%E8%BF%99%E7%A7%8D%E7%8E%B0%E8%B1%A1%E5%B0%B1%E7%A7%B0%E4%B9%8B%E4%B8%BA%E8%84%8F%E5%86%99%E3%80%82%E8%BF%99%E6%97%B6Session%20A%E4%B8%AD%E7%9A%84%E4%BA%8B%E5%8A%A1%E5%B0%B1%E5%BE%88%E6%87%B5%E9%80%BC%EF%BC%8C%E6%88%91%E6%98%8E%E6%98%8E%E6%8A%8A%E6%95%B0%E6%8D%AE%E6%9B%B4%E6%96%B0%E4%BA%86%EF%BC%8C%E6%9C%80%E5%90%8E%E4%B9%9F%E6%8F%90%E4%BA%A4%E4%BA%8B%E5%8A%A1%E4%BA%86%EF%BC%8C%E6%80%8E%E4%B9%88%E5%88%B0%E6%9C%80%E5%90%8E%E8%AF%B4%E8%87%AA%E5%B7%B1%E5%95%A5%E4%B9%9F%E6%B2%A1%E5%B9%B2%E5%91%A2%EF%BC%9F%0A%0A%23%23%23%23%20%E8%84%8F%E8%AF%BB%EF%BC%88Dirty%20Read%EF%BC%89%0A%E5%A6%82%E6%9E%9C**%E4%B8%80%E4%B8%AA%E4%BA%8B%E5%8A%A1%E8%AF%BB%E5%88%B0%E4%BA%86%E5%8F%A6%E4%B8%80%E4%B8%AA%E6%9C%AA%E6%8F%90%E4%BA%A4%E4%BA%8B%E5%8A%A1%E4%BF%AE%E6%94%B9%E8%BF%87%E7%9A%84%E6%95%B0%E6%8D%AE**%EF%BC%8C%E9%82%A3%E5%B0%B1%E6%84%8F%E5%91%B3%E7%9D%80%E5%8F%91%E7%94%9F%E4%BA%86**%E8%84%8F%E8%AF%BB**%EF%BC%8C%E7%A4%BA%E6%84%8F%E5%9B%BE%E5%A6%82%E4%B8%8B%EF%BC%9A%0A%0A%E5%A6%82%E4%B8%8A%E5%9B%BE%EF%BC%8CSession%20A%E5%92%8CSession%20B%E5%90%84%E5%BC%80%E5%90%AF%E4%BA%86%E4%B8%80%E4%B8%AA%E4%BA%8B%E5%8A%A1%EF%BC%8CSession%20B%E4%B8%AD%E7%9A%84%E4%BA%8B%E5%8A%A1%E5%85%88%E5%B0%86number%E5%88%97%E4%B8%BA1%E7%9A%84%E8%AE%B0%E5%BD%95%E7%9A%84name%E5%88%97%E6%9B%B4%E6%96%B0%E4%B8%BA'%E5%85%B3%E7%BE%BD'%EF%BC%8C%E7%84%B6%E5%90%8ESession%20A%E4%B8%AD%E7%9A%84%E4%BA%8B%E5%8A%A1%E5%86%8D%E5%8E%BB%E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D%80%E5%8F%91%E7%94%9F%E4%BA%86**%E5%B9%BB%E8%AF%BB**%EF%BC%8C%E7%A4%BA%E6%84%8F%E5%9B%BE%E5%A6%82%E4%B8%8B%EF%BC%9A!%5B5fec21182c12105502a10c26cd0c67e7.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1095%3A1)%0A%0A%E5%A6%82%E4%B8%8A%E5%9B%BE%EF%BC%8CSession%20A%E4%B8%AD%E7%9A%84%E4%BA%8B%E5%8A%A1%E5%85%88%E6%A0%B9%E6%8D%AE%E6%9D%A1%E4%BB%B6number%20%3E%200%E8%BF%99%E4%B8%AA%E6%9D%A1%E4%BB%B6%E6%9F%A5%E8%AF%A2%E8%A1%A8hero%EF%BC%8C%E5%BE%97%E5%88%B0%E4%BA%86name%E5%88%97%E5%80%BC%E4%B8%BA'%E5%88%98%E5%A4%87'%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%9B%E4%B9%8B%E5%90%8ESession%20B%E4%B8%AD%E6%8F%90%E4%BA%A4%E4%BA%86%E4%B8%80%E4%B8%AA%E9%9A%90%E5%BC%8F%E4%BA%8B%E5%8A%A1%EF%BC%8C%E8%AF%A5%E4%BA%8B%E5%8A%A1%E5%90%91%E8%A1%A8hero%E4%B8%AD%E6%8F%92%E5%85%A5%E4%BA%86%E4%B8%80%E6%9D%A1%E6%96%B0%E8%AE%B0%E5%BD%95%EF%BC%9B%E4%B9%8B%E5%90%8ESession%20A%E4%B8%AD%E7%9A%84%E4%BA%8B%E5%8A%A1%E5%86%8D%E6%A0%B9%E6%8D%AE%E7%9B%B8%E5%90%8C%E7%9A%84%E6%9D%A1%E4%BB%B6number%20%3E%200%E6%9F%A5%E8%AF%A2%E8%A1%A8hero%EF%BC%8C%E5%BE%97%E5%88%B0%E7%9A%84%E7%BB%93%E6%9E%9C%E9%9B%86%E4%B8%AD%E5%8C%85%E5%90%ABSession%20B%E4%B8%AD%E7%9A%84%E4%BA%8B%E5%8A%A1%E6%96%B0%E6%8F%92%E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7%E5%88%AB%E8%B6%8A%E4%BD%8E%EF%BC%8C%E8%B6%8A%E4%B8%A5%E9%87%8D%E7%9A%84%E9%97%AE%E9%A2%98%E5%B0%B1%E8%B6%8A%E5%8F%AF%E8%83%BD%E5%8F%91%E7%94%9F**%E3%80%82%E6%9C%89%E4%B8%80%E5%B8%AE%E4%BA%BA%EF%BC%88%E5%B9%B6%E4%B8%8D%E6%98%AF%E8%AE%BE%E8%AE%A1MySQL%E7%9A%84%E5%A4%A7%E5%8F%94%E4%BB%AC%EF%BC%89%E5%88%B6%E5%AE%9A%E4%BA%86%E4%B8%80%E4%B8%AA%E6%89%80%E8%B0%93%E7%9A%84S**QL%E6%A0%87%E5%87%86**%EF%BC%8C%E5%9C%A8%E6%A0%87%E5%87%86%E4%B8%AD%E8%AE%BE%E7%AB%8B%E4%BA%864%E4%B8%AA**%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB**%EF%BC%9A%0A%0A*%20**Read%20Uncommitted**%EF%BC%9A%E8%AF%BB%E6%9C%AA%E6%8F%90%E4%BA%A4%0A*%20**Read%20Committed**%EF%BC%9A%E8%AF%BB%E5%B7%B2%E6%8F%90%E4%BA%A4%0A*%20**Repeatable%20Read**%EF%BC%9A%E5%8F%AF%E9%87%8D%E5%A4%8D%E8%AF%BB%0A*%20**Serializable**%EF%BC%9A%E5%8F%AF%E4%B8%B2%E8%A1%8C%E5%8C%96%0A%0A%0A**SQL%E6%A0%87%E5%87%86**%E4%B8%AD%E8%A7%84%E5%AE%9A%EF%BC%8C%E9%92%88%E5%AF%B9%E4%B8%8D%E5%90%8C%E7%9A%84%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%EF%BC%8C%E5%B9%B6%E5%8F%91%E4%BA%8B%E5%8A%A1**%E5%8F%AF%E4%BB%A5%E5%8F%91%E7%94%9F**%E4%B8%8D%E5%90%8C%E4%B8%A5%E9%87%8D%E7%A8%8B%E5%BA%A6%E7%9A%84%E9%97%AE%E9%A2%98%EF%BC%8C%E5%85%B7%E4%BD%93%E6%83%85%E5%86%B5%E5%A6%82%E4%B8%8B%EF%BC%9A%0A!%5B12b321236a85a58a9ec7c38a5425edd5.png%5D(en-resource%3A%2F%2Fdatabase%2F1097%3A1)%0A%0A%E4%B9%9F%E5%B0%B1%E6%98%AF%E8%AF%B4%EF%BC%9A%0A%0A*%20**Read%20Uncommitted**%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%EF%BC%8C%E5%8F%AF%E8%83%BD%E5%8F%91%E7%94%9F**%E8%84%8F%E8%AF%BB%E3%80%81%E4%B8%8D%E5%8F%AF%E9%87%8D%E5%A4%8D%E8%AF%BB**%E5%92%8C**%E5%B9%BB%E8%AF%BB**%E9%97%AE%E9%A2%98%EF%BC%9B%0A*%20**Read%20Committed**%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%EF%BC%8C%E5%8F%AF%E8%83%BD%E5%8F%91%E7%94%9F**%E4%B8%8D%E5%8F%AF%E9%87%8D%E5%A4%8D%E8%AF%BB**%E5%92%8C**%E5%B9%BB%E8%AF%BB**%EF%BC%8C%E4%BD%86%E6%98%AF%E4%B8%8D%E5%8F%AF%E4%BB%A5%E5%8F%91%E7%94%9F**%E8%84%8F%E8%AF%BB**%E9%97%AE%E9%A2%98%EF%BC%9B%0A*%20**Repeatable%20Read**%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%EF%BC%8C%E5%8F%AF%E8%83%BD%E5%8F%91%E7%94%9F**%E5%B9%BB%E8%AF%BB**%E9%97%AE%E9%A2%98%EF%BC%8C%E4%BD%86%E6%98%AF%E4%B8%8D%E5%8F%AF%E4%BB%A5%E5%8F%91%E7%94%9F**%E8%84%8F%E8%AF%BB**%E5%92%8C**%E4%B8%8D%E5%8F%AF%E9%87%8D%E5%A4%8D%E5%BA%A6**%E9%97%AE%E9%A2%98%EF%BC%9B%0A*%20**Serializable**%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%EF%BC%8C%E5%90%84%E7%A7%8D%E9%97%AE%E9%A2%98%E9%83%BD%E4%B8%8D%E5%8F%AF%E4%BB%A5%E5%8F%91%E7%94%9F%E3%80%82%0A%0A%E5%AF%B9%E4%BA%8E**%E8%84%8F%E5%86%99**%EF%BC%8C**%E5%9B%A0%E4%B8%BA%E8%84%8F%E5%86%99%E6%98%AF%E4%B8%AA%E9%9D%9E%E5%B8%B8%E4%B8%A5%E9%87%8D%E7%9A%84%E9%97%AE%E9%A2%98%EF%BC%8C%E6%97%A0%E8%AE%BA%E6%98%AF%E5%93%AA%E7%A7%8D%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%EF%BC%8C%E9%83%BD%E4%B8%8D%E5%85%81%E8%AE%B8%E8%84%8F%E5%86%99%E7%9A%84%E6%83%85%E5%86%B5%E5%8F%91%E7%94%9F**%E3%80%82%0A%0A%23%23%23%201-3%20MySQL%E4%B8%AD%E6%94%AF%E6%8C%81%E7%9A%84%E5%9B%9B%E7%A7%8D%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%0A%0A%E4%B8%8D%E5%90%8C%E7%9A%84%E6%95%B0%E6%8D%AE%E5%BA%93%E5%8E%82%E5%95%86%E5%AF%B9SQL%E6%A0%87%E5%87%86%E4%B8%AD%E8%A7%84%E5%AE%9A%E7%9A%84%E5%9B%9B%E7%A7%8D%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E6%94%AF%E6%8C%81%E4%B8%8D%E4%B8%80%E6%A0%B7%EF%BC%8C%E6%AF%94%E6%96%B9%E8%AF%B4Oracle%E5%B0%B1%E5%8F%AA%E6%94%AF%E6%8C%81Read%20Committed%E5%92%8CSerializable%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E3%80%82%E6%9C%AC%E4%B9%A6%E4%B8%AD%E6%89%80%E8%AE%A8%E8%AE%BA%E7%9A%84MySQL%E8%99%BD%E7%84%B6%E6%94%AF%E6%8C%814%E7%A7%8D%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%EF%BC%8C%E4%BD%86%E4%B8%8ESQL%E6%A0%87%E5%87%86%E4%B8%AD%E6%89%80%E8%A7%84%E5%AE%9A%E7%9A%84%E5%90%84%E7%BA%A7%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E5%85%81%E8%AE%B8%E5%8F%91%E7%94%9F%E7%9A%84%E9%97%AE%E9%A2%98%E5%8D%B4%E6%9C%89%E4%BA%9B%E5%87%BA%E5%85%A5%EF%BC%8C**MySQL%E5%9C%A8Repeatable%20Read%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%8B%EF%BC%8C%E6%98%AF%E5%8F%AF%E4%BB%A5%E7%A6%81%E6%AD%A2%E5%B9%BB%E8%AF%BB%E9%97%AE%E9%A2%98%E7%9A%84%E5%8F%91%E7%94%9F%E7%9A%84**%E3%80%82%0A%0A**MySQL**%E7%9A%84%E9%BB%98%E8%AE%A4%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%BA**Repeatable%20Read**%E3%80%82%0A%0A%23%23%23%23%20%E5%A6%82%E4%BD%95%E8%AE%BE%E7%BD%AE%E4%BA%8B%E5%8A%A1%E7%9A%84%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%0A%0A%E5%8F%AF%E4%BB%A5%E9%80%9A%E8%BF%87%E4%B8%8B%E9%9D%A2%E8%AF%AD%E5%8F%A5%E4%BF%AE%E6%94%B9%E4%BA%8B%E5%8A%A1%E7%9A%84%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%EF%BC%9A%0A**SET%20%5B%20GLOBAL%20%7C%20SESSION%20%5D%20TRANSACTION%20ISOLATION%20LEVEL%20level%EF%BC%9B**%0A%0A%E5%85%B6%E4%B8%AD%E7%9A%84**level**%E5%8F%AF%E9%80%89%E5%80%BC%E6%9C%894%E4%B8%AA%EF%BC%9A%0A*%20READ%20UNCOMMITTED%0A*%20READ%20COMMITTED%0A*%20REPEATABLE%20READ%0A*%20SERIALIZABLE%0A%0A%E8%AE%BE%E7%BD%AE%E4%BA%8B%E5%8A%A1%E7%9A%84%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E8%AF%AD%E5%8F%A5%E4%B8%AD%EF%BC%8C%E5%9C%A8**SET**%E5%85%B3%E9%94%AE%E5%AD%97%E5%90%8E%E5%8F%AF%E4%BB%A5%E6%94%BE%E7%BD%AE**GLOBAL**%E5%85%B3%E9%94%AE%E5%AD%97%E3%80%81**SESSION**%E5%85%B3%E9%94%AE%E5%AD%97%E6%88%96%E8%80%85%E4%BB%80%E4%B9%88%E9%83%BD%E4%B8%8D%E6%94%BE%EF%BC%8C%E8%BF%99%E6%A0%B7%E4%BC%9A%E5%AF%B9%E4%B8%8D%E5%90%8C%E8%8C%83%E5%9B%B4%E7%9A%84%E4%BA%8B%E5%8A%A1%E4%BA%A7%E7%94%9F%E4%B8%8D%E5%90%8C%E7%9A%84%E5%BD%B1%E5%93%8D%EF%BC%8C%E5%85%B7%E4%BD%93%E5%A6%82%E4%B8%8B%EF%BC%9A%0A%0A*%20%E4%BD%BF%E7%94%A8**GLOBAL**%E5%85%B3%E9%94%AE%E5%AD%97%EF%BC%88%E5%9C%A8**%E5%85%A8%E5%B1%80**%E8%8C%83%E5%9B%B4%E5%BD%B1%E5%93%8D%EF%BC%89%EF%BC%9A%0A**SET%20GLOBAL%20TRANSACTION%20ISOLATION%20LEVEL%20SERIALIZABLE%EF%BC%9B**%0A%E5%88%99%EF%BC%9A%0Aa.%20%E5%8F%AA%E5%AF%B9%E6%89%A7%E8%A1%8C%E5%AE%8C%E8%AF%A5%E8%AF%AD%E5%8F%A5%E4%B9%8B%E5%90%8E%E4%BA%A7%E7%94%9F%E7%9A%84%E4%BC%9A%E8%AF%9D%E8%B5%B7%E4%BD%9C%E7%94%A8%EF%BC%9B%0Ab.%20%E5%AF%B9%E5%BD%93%E5%89%8D%E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ALIZABLE%EF%BC%8C%E9%82%A3%E4%B9%88%E4%BA%8B%E5%8A%A1%E7%9A%84%E9%BB%98%E8%AE%A4%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E5%B0%B1%E4%BB%8E%E5%8E%9F%E6%9D%A5%E7%9A%84REPEATABLE%20READ%E5%8F%98%E6%88%90%E4%BA%86SERIALIZABLE%E3%80%82%0A%0A%0A%E6%83%B3%E8%A6%81%E6%9F%A5%E7%9C%8B%E5%BD%93%E5%89%8D%E4%BC%9A%E8%AF%9D%E9%BB%98%E8%AE%A4%E7%9A%84%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E5%8F%AF%E4%BB%A5%E9%80%9A%E8%BF%87%E6%9F%A5%E7%9C%8B**%E7%B3%BB%E7%BB%9F%E5%8F%98%E9%87%8Ftransaction_isolation**%E7%9A%84%E5%80%BC%E6%9D%A5%E7%A1%AE%E5%AE%9A%EF%BC%9A%0A!%5B9d25ac5c376ea8a6fcc7997fe5fcc6fa.png%5D(en-resource%3A%2F%2Fdatabase%2F1099%3A1)%0A!%5Ba76233993c6a34d89b353e14aa206b04.png%5D(en-resource%3A%2F%2Fdatabase%2F1101%3A1)%0A%0A%0A%0A%23%23%202%20MVCC%E5%8E%9F%E7%90%86%0A**MVCC%EF%BC%8C%E5%85%A8%E5%90%8D%EF%BC%9AMulti-Version%20Concurrency%20Control%EF%BC%8C%E4%B8%AD%E6%96%87%E5%90%8D%EF%BC%9A%E5%A4%9A%E7%89%88%E6%9C%AC%E5%B9%B6%E5%8F%91%E6%8E%A7%E5%88%B6**%0A%0A%E5%A4%9A%E7%89%88%E6%9C%AC%E5%B9%B6%E5%8F%91%E6%8E%A7%E5%88%B6%EF%BC%88Multi-Version%20Concurrency%20Control%2C%20MVCC%EF%BC%89%E6%98%AF%20MySQL%20%E7%9A%84%20InnoDB%20%E5%AD%98%E5%82%A8%E5%BC%95%E6%93%8E%E5%AE%9E%E7%8E%B0**Read%20Committed%E5%92%8CR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84%B6%E5%90%8E%E8%BF%99%E4%B8%AA%E9%9A%90%E8%97%8F%E5%88%97%E5%B0%B1%E7%9B%B8%E5%BD%93%E4%BA%8E%E4%B8%80%E4%B8%AA%E6%8C%87%E9%92%88%EF%BC%8C%E5%8F%AF%E4%BB%A5%E9%80%9A%E8%BF%87%E5%AE%83%E6%9D%A5%E6%89%BE%E5%88%B0%E8%AF%A5%E8%AE%B0%E5%BD%95%E4%BF%AE%E6%94%B9%E5%89%8D%E7%9A%84%E4%BF%A1%E6%81%AF%E3%80%82%0A%0A%0A%E6%AF%94%E6%96%B9%E8%AF%B4%E8%A1%A8hero%E7%8E%B0%E5%9C%A8%E5%8F%AA%E5%8C%85%E5%90%AB%E4%B8%80%E6%9D%A1%E8%AE%B0%E5%BD%95%EF%BC%9A%0A!%5B7136c40b06f1fced4a29b103fef63850.png%5D(en-resource%3A%2F%2Fdatabase%2F1105%3A1)%0A%0A%E5%81%87%E8%AE%BE%E6%8F%92%E5%85%A5%E8%AF%A5%E8%AE%B0%E5%BD%95%E7%9A%84%E4%BA%8B%E5%8A%A1id%E4%B8%BA80%EF%BC%8C%E9%82%A3%E4%B9%88%E6%AD%A4%E5%88%BB%E8%AF%A5%E6%9D%A1%E8%AE%B0%E5%BD%95%E7%9A%84%E7%A4%BA%E6%84%8F%E5%9B%BE%E5%A6%82%E4%B8%8B%E6%89%80%E7%A4%BA%EF%BC%9A%0A!%5B3e5605fdb001b58bdbc8bfbce06bad37.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1107%3A1)%0A%0A!%5B26807a580c27721799ad2d42c04c8cb8.png%5D(en-resource%3A%2F%2Fdatabase%2F1109%3A1)%0A%0A%0A%E5%81%87%E8%AE%BE%E4%B9%8B%E5%90%8E%E4%B8%A4%E4%B8%AA%E4%BA%8B%E5%8A%A1id%E5%88%86%E5%88%AB%E4%B8%BA100%E3%80%81200%E7%9A%84%E4%BA%8B%E5%8A%A1%E5%AF%B9%E8%BF%99%E6%9D%A1%E8%AE%B0%E5%BD%95%E8%BF%9B%E8%A1%8CUPDATE%E6%93%8D%E4%BD%9C%EF%BC%8C%E6%93%8D%E4%BD%9C%E6%B5%81%E7%A8%8B%E5%A6%82%E4%B8%8B%EF%BC%9A%0A!%5B5c909c1291968994ee35d3a5d0d79868.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1111%3A1)%0A%0A%E6%AF%8F%E6%AC%A1%E5%AF%B9%E8%AE%B0%E5%BD%95%E8%BF%9B%E8%A1%8C%E6%94%B9%E5%8A%A8%EF%BC%8C%E9%83%BD%E4%BC%9A%E8%AE%B0%E5%BD%95%E4%B8%80%E6%9D%A1**undo%E6%97%A5%E5%BF%97**%EF%BC%8C%E6%AF%8F%E6%9D%A1undo%E6%97%A5%E5%BF%97%E4%B9%9F%E9%83%BD%E6%9C%89%E4%B8%80%E4%B8%AAroll_pointer%E5%B1%9E%E6%80%A7%EF%BC%88INSERT%E6%93%8D%E4%BD%9C%E5%AF%B9%E5%BA%94%E7%9A%84undo%E6%97%A5%E5%BF%97%E6%B2%A1%E6%9C%89%E8%AF%A5%E5%B1%9E%E6%80%A7%EF%BC%8C%E5%9B%A0%E4%B8%BA%E8%AF%A5%E8%AE%B0%E5%BD%95%E5%B9%B6%E6%B2%A1%E6%9C%89%E6%9B%B4%E6%97%A9%E7%9A%84%E7%89%88%E6%9C%AC%EF%BC%89%EF%BC%8C%E5%8F%AF%E4%BB%A5%E5%B0%86%E8%BF%99%E4%BA%9Bundo%E6%97%A5%E5%BF%97%E9%83%BD%E8%BF%9E%E8%B5%B7%E6%9D%A5%EF%BC%8C%E4%B8%B2%E6%88%90%E4%B8%80%E4%B8%AA%E9%93%BE%E8%A1%A8%EF%BC%8C%E6%89%80%E4%BB%A5%E7%8E%B0%E5%9C%A8%E7%9A%84%E6%83%85%E5%86%B5%E5%B0%B1%E5%83%8F%E4%B8%8B%E5%9B%BE%E4%B8%80%E6%A0%B7%EF%BC%9A%0A!%5B2a6468f5578bb048603b89a15209cfa6.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1113%3A1)%0A%0A%E5%AF%B9%E8%AF%A5%E8%AE%B0%E5%BD%95%E6%AF%8F%E6%AC%A1%E6%9B%B4%E6%96%B0%E5%90%8E%EF%BC%8C%E9%83%BD%E4%BC%9A%E5%B0%86%E6%97%A7%E5%80%BC%E6%94%BE%E5%88%B0%E4%B8%80%E6%9D%A1undo%E6%97%A5%E5%BF%97%E4%B8%AD%EF%BC%8C%E5%B0%B1%E7%AE%97%E6%98%AF%E8%AF%A5%E8%AE%B0%E5%BD%95%E7%9A%84%E4%B8%80%E4%B8%AA%E6%97%A7%E7%89%88%E6%9C%AC%EF%BC%8C%E9%9A%8F%E7%9D%80%E6%9B%B4%E6%96%B0%E6%AC%A1%E6%95%B0%E7%9A%84%E5%A2%9E%E5%A4%9A%EF%BC%8C%E6%89%80%E6%9C%89%E7%9A%84%E7%89%88%E6%9C%AC%E9%83%BD%E4%BC%9A%E8%A2%AB**roll_pointer%E5%B1%9E%E6%80%A7**%E8%BF%9E%E6%8E%A5%E6%88%90%E4%B8%80%E4%B8%AA**%E9%93%BE%E8%A1%A8**%EF%BC%8C%E6%88%91%E4%BB%AC%E6%8A%8A**%E8%BF%99%E4%B8%AA%E9%93%BE%E8%A1%A8**%E7%A7%B0%E4%B9%8B%E4%B8%BA**%E7%89%88%E6%9C%AC%E9%93%BE**%EF%BC%8C**%E7%89%88%E6%9C%AC%E9%93%BE%E7%9A%84%E5%A4%B4%E8%8A%82%E7%82%B9%E5%B0%B1%E6%98%AF%E5%BD%93%E5%89%8D%E8%AE%B0%E5%BD%95%E6%9C%80%E6%96%B0%E7%9A%84%E5%80%BC**%E3%80%82%E5%8F%A6%E5%A4%96%EF%BC%8C**%E6%AF%8F%E4%B8%AA%E7%89%88%E6%9C%AC%E4%B8%AD%E8%BF%98%E5%8C%85%E5%90%AB%E7%94%9F%E6%88%90%E8%AF%A5%E7%89%88%E6%9C%AC%E6%97%B6%E5%AF%B9%E5%BA%94%E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%BB%E8%A6%81%E5%8C%85%E5%90%AB4%E4%B8%AA%E6%AF%94%E8%BE%83%E9%87%8D%E8%A6%81%E7%9A%84%E5%86%85%E5%AE%B9%EF%BC%9A%0A%0A*%20**m_ids**%EF%BC%9A%E8%A1%A8%E7%A4%BA%E5%9C%A8%E7%94%9F%E6%88%90**ReadView**%E6%97%B6%E5%BD%93%E5%89%8D%E7%B3%BB%E7%BB%9F%E4%B8%AD%E6%B4%BB%E8%B7%83%E7%9A%84%E8%AF%BB%E5%86%99%E4%BA%8B%E5%8A%A1%E7%9A%84**%E4%BA%8B%E5%8A%A1id**%E5%88%97%E8%A1%A8%EF%BC%9B%0A*%20**min_trx_id**%EF%BC%9A%E8%A1%A8%E7%A4%BA%E5%9C%A8%E7%94%9F%E6%88%90**ReadView**%E6%97%B6%E5%BD%93%E5%89%8D%E7%B3%BB%E7%BB%9F%E4%B8%AD%E6%B4%BB%E8%B7%83%E7%9A%84%E8%AF%BB%E5%86%99%E4%BA%8B%E5%8A%A1%E4%B8%AD%E6%9C%80%E5%B0%8F%E7%9A%84**%E4%BA%8B%E5%8A%A1id**%EF%BC%8C%E4%B9%9F%E5%B0%B1%E6%98%AFm_ids%E7%9A%84%E6%9C%80%E5%B0%8F%E5%80%BC%EF%BC%9B%0A*%20**max_trx_id**%EF%BC%9A%E8%A1%A8%E7%A4%BA%E5%9C%A8%E7%94%9F%E6%88%90**ReadView**%E6%97%B6%E7%B3%BB%E7%BB%9F%E4%B8%AD%E5%BA%94%E8%AF%A5%E5%88%86%E9%85%8D%E7%BB%99%E4%B8%8B%E4%B8%80%E4%B8%AA%E4%BA%8B%E5%8A%A1%E7%9A%84id%E5%80%BC%EF%BC%9B%0A%0A!%5B0879e962cadd444931183c98df380132.png%5D(en-resource%3A%2F%2Fdatabase%2F1115%3A1)%0A%0A*%20**creator_trx_id**%EF%BC%9A%E8%A1%A8%E7%A4%BA%E7%94%9F%E6%88%90%E8%AF%A5**ReadView**%E7%9A%84%E4%BA%8B%E5%8A%A1%E7%9A%84**%E4%BA%8B%E5%8A%A1id**%E3%80%82%0A%0A!%5B374a656952c4b78d2c101bba58f27125.png%5D(en-resource%3A%2F%2Fdatabase%2F1117%3A1)%0A%0A%E6%9C%89%E4%BA%86%E8%BF%99%E4%B8%AAReadView%EF%BC%8C%E8%BF%99%E6%A0%B7%E5%9C%A8%E8%AE%BF%E9%97%AE%E6%9F%90%E6%9D%A1%E8%AE%B0%E5%BD%95%E6%97%B6%EF%BC%8C%E5%8F%AA%E9%9C%80%E8%A6%81%E6%8C%89%E7%85%A7%E4%B8%8B%E8%BE%B9%E7%9A%84%E6%AD%A5%E9%AA%A4%E5%88%A4%E6%96%AD%E8%AE%B0%E5%BD%95%E7%9A%84%E6%9F%90%E4%B8%AA%E7%89%88%E6%9C%AC%E6%98%AF%E5%90%A6%E5%8F%AF%E8%A7%81%EF%BC%9A%0A%0A*%20%E5%A6%82%E6%9E%9C%E8%A2%AB%E8%AE%BF%E9%97%AE%E7%89%88%E6%9C%AC%E7%9A%84**trx_id**%E5%B1%9E%E6%80%A7%E5%80%BC%E4%B8%8E**ReadView**%E4%B8%AD%E7%9A%84**creator_trx_id**%E5%80%BC%E7%9B%B8%E5%90%8C%EF%BC%8C%E6%84%8F%E5%91%B3%E7%9D%80%E5%BD%93%E5%89%8D%E4%BA%8B%E5%8A%A1%E5%9C%A8%E8%AE%BF%E9%97%AE%E8%87%AA%E5%B7%B1%E4%BF%AE%E6%94%B9%E8%BF%87%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%8C%E6%89%80%E4%BB%A5%E8%AF%A5%E7%89%88%E6%9C%AC%E5%8F%AF%E4%BB%A5%E8%A2%AB%E5%BD%93%E5%89%8D%E4%BA%8B%E5%8A%A1%E8%AE%BF%E9%97%AE%EF%BC%9B%0A*%20%E5%A6%82%E6%9E%9C%E8%A2%AB%E8%AE%BF%E9%97%AE%E7%89%88%E6%9C%AC%E7%9A%84**trx_id**%E5%B1%9E%E6%80%A7%E5%80%BC%E5%B0%8F%E4%BA%8E**ReadView**%E4%B8%AD%E7%9A%84**min_trx_id**%E5%80%BC%EF%BC%8C%E8%A1%A8%E6%98%8E%E7%94%9F%E6%88%90%E8%AF%A5%E7%89%88%E6%9C%AC%E7%9A%84%E4%BA%8B%E5%8A%A1%E5%9C%A8%E5%BD%93%E5%89%8D%E4%BA%8B%E5%8A%A1%E7%94%9F%E6%88%90**ReadView**%E5%89%8D%E5%B7%B2%E7%BB%8F%E6%8F%90%E4%BA%A4%EF%BC%8C%E6%89%80%E4%BB%A5%E8%AF%A5%E7%89%88%E6%9C%AC%E5%8F%AF%E4%BB%A5%E8%A2%AB%E5%BD%93%E5%89%8D%E4%BA%8B%E5%8A%A1%E8%AE%BF%E9%97%AE%EF%BC%9B%0A*%20%E5%A6%82%E6%9E%9C%E8%A2%AB%E8%AE%BF%E9%97%AE%E7%89%88%E6%9C%AC%E7%9A%84**trx_id**%E5%B1%9E%E6%80%A7%E5%80%BC%E5%A4%A7%E4%BA%8E**ReadView**%E4%B8%AD%E7%9A%84**max_trx_id**%E5%80%BC%EF%BC%8C%E8%A1%A8%E6%98%8E%E7%94%9F%E6%88%90%E8%AF%A5%E7%89%88%E6%9C%AC%E7%9A%84%E4%BA%8B%E5%8A%A1%E5%9C%A8%E5%BD%93%E5%89%8D%E4%BA%8B%E5%8A%A1%E7%94%9F%E6%88%90**ReadView**%E5%90%8E%E6%89%8D%E5%BC%80%E5%90%AF%EF%BC%8C%E6%89%80%E4%BB%A5%E8%AF%A5%E7%89%88%E6%9C%AC%E4%B8%8D%E5%8F%AF%E4%BB%A5%E8%A2%AB%E5%BD%93%E5%89%8D%E4%BA%8B%E5%8A%A1%E8%AE%BF%E9%97%AE%EF%BC%9B%0A*%20%E5%A6%82%E6%9E%9C%E8%A2%AB%E8%AE%BF%E9%97%AE%E7%89%88%E6%9C%AC%E7%9A%84**trx_id**%E5%B1%9E%E6%80%A7%E5%80%BC%E5%9C%A8**ReadView**%E7%9A%84**min_trx_id**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%B6%E6%9C%BA%E4%B8%8D%E5%90%8C**%E3%80%82%E8%BF%98%E6%98%AF%E4%BB%A5%E8%A1%A8hero%E4%B8%BA%E4%BE%8B%E6%9D%A5%EF%BC%8C%E5%81%87%E8%AE%BE%E7%8E%B0%E5%9C%A8%E8%A1%A8hero%E4%B8%AD%E5%8F%AA%E6%9C%89%E4%B8%80%E6%9D%A1%E7%94%B1%E4%BA%8B%E5%8A%A1id%E4%B8%BA80%E7%9A%84%E4%BA%8B%E5%8A%A1%E6%8F%92%E5%85%A5%E7%9A%84%E4%B8%80%E6%9D%A1%E8%AE%B0%E5%BD%95%EF%BC%9A%0A!%5Bbe17bd4c031c3358c7dd1b903a2d05d4.png%5D(en-resource%3A%2F%2Fdatabase%2F1119%3A1)%0A%0A%E6%8E%A5%E4%B8%8B%E6%9D%A5%E7%9C%8B%E4%B8%80%E4%B8%8BREAD%20COMMITTED%E5%92%8CREPEATABLE%20READ%E6%89%80%E8%B0%93%E7%9A%84%E7%94%9F%E6%88%90ReadView%E7%9A%84%E6%97%B6%E6%9C%BA%E4%B8%8D%E5%90%8C%E5%88%B0%E5%BA%95%E4%B8%8D%E5%90%8C%E5%9C%A8%E5%93%AA%E9%87%8C%E3%80%82%0A%0A%23%23%23%23%202-2-1%20Read%20Committed%20%E6%AF%8F%E6%AC%A1%E8%AF%BB%E5%8F%96%E6%95%B0%E6%8D%AE%E5%89%8D%E9%83%BD%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AAReadView%0A%0A%E6%AF%94%E6%96%B9%E8%AF%B4%E7%8E%B0%E5%9C%A8%E7%B3%BB%E7%BB%9F%E9%87%8C%E6%9C%89%E4%B8%A4%E4%B8%AA%E4%BA%8B%E5%8A%A1id%E5%88%86%E5%88%AB%E4%B8%BA100%E3%80%81200%E7%9A%84%E4%BA%8B%E5%8A%A1%E5%9C%A8%E6%89%A7%E8%A1%8C%EF%BC%9A%0A!%5B11f74b1078e28c101ab20a4af839c177.png%5D(en-resource%3A%2F%2Fdatabase%2F1121%3A1)%0A%0A%E6%AD%A4%E5%88%BB%EF%BC%8C%E8%A1%A8hero%E4%B8%ADnumber%E4%B8%BA1%E7%9A%84%E8%AE%B0%E5%BD%95%E5%BE%97%E5%88%B0%E7%9A%84%E7%89%88%E6%9C%AC%E9%93%BE%E8%A1%A8%E5%A6%82%E4%B8%8B%E6%89%80%E7%A4%BA%EF%BC%9A%0A!%5Bf409a2ff7ea1cbcd1a6a5d442c7bd201.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1123%3A1)%0A%0A%E5%81%87%E8%AE%BE%E7%8E%B0%E5%9C%A8%E6%9C%89%E4%B8%80%E4%B8%AA%E4%BD%BF%E7%94%A8**READ%20COMMITTED**%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E7%9A%84%E4%BA%8B%E5%8A%A1%E5%BC%80%E5%A7%8B%E6%89%A7%E8%A1%8C%EF%BC%9A%0A!%5B129197dcdadb33902e6f9a4270d82b7d.png%5D(en-resource%3A%2F%2Fdatabase%2F1125%3A1)%0A%0A%0A%E8%BF%99%E4%B8%AASELECT1%E7%9A%84%E6%89%A7%E8%A1%8C%E8%BF%87%E7%A8%8B%E5%A6%82%E4%B8%8B%EF%BC%9A%0A%0A*%20%E5%9C%A8%E6%89%A7%E8%A1%8CSELECT%E8%AF%AD%E5%8F%A5%E6%97%B6%E4%BC%9A%E5%85%88%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AAReadView%EF%BC%8CReadView%E7%9A%84m_ids%E5%88%97%E8%A1%A8%E7%9A%84%E5%86%85%E5%AE%B9%E5%B0%B1%E6%98%AF%5B100%2C%20200%5D%EF%BC%8Cmin_trx_id%E4%B8%BA100%EF%BC%8Cmax_trx_id%E4%B8%BA201%EF%BC%8Ccreator_trx_id%E4%B8%BA0%EF%BC%9B%0A*%20%E7%84%B6%E5%90%8E%E4%BB%8E%E7%89%88%E6%9C%AC%E9%93%BE%E4%B8%AD%E6%8C%91%E9%80%89%E5%8F%AF%E8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88%98%E5%A4%87'%EF%BC%8C%E8%AF%A5%E7%89%88%E6%9C%AC%E7%9A%84trx_id%E5%80%BC%E4%B8%BA80%EF%BC%8C%E5%B0%8F%E4%BA%8EReadView%E4%B8%AD%E7%9A%84min_trx_id%E5%80%BC100%EF%BC%8C%E6%89%80%E4%BB%A5%E8%BF%99%E4%B8%AA%E7%89%88%E6%9C%AC%E6%98%AF%E7%AC%A6%E5%90%88%E8%A6%81%E6%B1%82%E7%9A%84%EF%BC%8C%E6%9C%80%E5%90%8E%E8%BF%94%E5%9B%9E%E7%BB%99%E7%94%A8%E6%88%B7%E7%9A%84%E7%89%88%E6%9C%AC%E5%B0%B1%E6%98%AF%E8%BF%99%E6%9D%A1%E5%88%97name%E4%B8%BA'%E5%88%98%E5%A4%87'%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%9B%0A%0A%0A%E4%B9%8B%E5%90%8E%EF%BC%8C%E6%88%91%E4%BB%AC%E6%8A%8A%E4%BA%8B%E5%8A%A1id%E4%B8%BA100%E7%9A%84%E4%BA%8B%E5%8A%A1%E6%8F%90%E4%BA%A4%E4%B8%80%E4%B8%8B%EF%BC%8C%E5%B0%B1%E5%83%8F%E8%BF%99%E6%A0%B7%EF%BC%9A!%5B0c6d6996c490c89ce57f193c2044e4fc.png%5D(en-resource%3A%2F%2Fdatabase%2F1129%3A1)%0A%0A%E7%84%B6%E5%90%8E%E5%86%8D%E5%88%B0%E4%BA%8B%E5%8A%A1id%E4%B8%BA200%E7%9A%84%E4%BA%8B%E5%8A%A1%E4%B8%AD%E6%9B%B4%E6%96%B0%E4%B8%80%E4%B8%8B%E8%A1%A8hero%E4%B8%ADnumber%E4%B8%BA1%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%9A!%5Bfb215e754d31e9764d0ff4fbe2d70459.png%5D(en-resource%3A%2F%2Fdatabase%2F1131%3A1)%0A%0A%E6%AD%A4%E5%88%BB%EF%BC%8C%E8%A1%A8hero%E4%B8%ADnumber%E4%B8%BA1%E7%9A%84%E8%AE%B0%E5%BD%95%E7%9A%84%E7%89%88%E6%9C%AC%E9%93%BE%E5%B0%B1%E9%95%BF%E8%BF%99%E6%A0%B7%EF%BC%9A%0A!%5Bebfebc7edfb5809f5c17d790a30d77a9.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1133%3A1)%0A%0A%0A%E7%84%B6%E5%90%8E%E5%86%8D%E5%88%B0%E5%88%9A%E6%89%8D%E4%BD%BF%E7%94%A8READ%20COMMITTED%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E7%9A%84%E4%BA%8B%E5%8A%A1%E4%B8%AD%E7%BB%A7%E7%BB%AD%E6%9F%A5%E6%89%BE%E8%BF%99%E4%B8%AAnumber%E4%B8%BA1%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%8C%E5%A6%82%E4%B8%8B%EF%BC%9A%0A!%5B04e04ed1be8717a57f042930811dd231.png%5D(en-resource%3A%2F%2Fdatabase%2F1135%3A1)%0A%0A%E8%BF%99%E4%B8%AASELECT2%E7%9A%84%E6%89%A7%E8%A1%8C%E8%BF%87%E7%A8%8B%E5%A6%82%E4%B8%8B%EF%BC%9A%0A%0A*%20%E5%9C%A8%E6%89%A7%E8%A1%8CSELECT%E8%AF%AD%E5%8F%A5%E6%97%B6%E4%BC%9A**%E5%8F%88%E4%BC%9A%E5%8D%95%E7%8B%AC%E7%94%9F%E6%88%90**%E4%B8%80%E4%B8%AAReadView%EF%BC%8C%E8%AF%A5ReadView%E7%9A%84m_ids%E5%88%97%E8%A1%A8%E7%9A%84%E5%86%85%E5%AE%B9%E5%B0%B1%E6%98%AF%5B200%5D%EF%BC%88%E4%BA%8B%E5%8A%A1id%E4%B8%BA100%E7%9A%84%E9%82%A3%E4%B8%AA%E4%BA%8B%E5%8A%A1%E5%B7%B2%E7%BB%8F%E6%8F%90%E4%BA%A4%E4%BA%86%EF%BC%8C%E6%89%80%E4%BB%A5%E5%86%8D%E6%AC%A1%E7%94%9F%E6%88%90%E5%BF%AB%E7%85%A7%E6%97%B6%E5%B0%B1%E6%B2%A1%E6%9C%89%E5%AE%83%E4%BA%86%EF%BC%89%EF%BC%8Cmin_trx_id%E4%B8%BA200%EF%BC%8Cmax_trx_id%E4%B8%BA201%EF%BC%8Ccreator_trx_id%E4%B8%BA0%EF%BC%9B%E2%80%99%0A*%20%E7%84%B6%E5%90%8E%E4%BB%8E%E7%89%88%E6%9C%AC%E9%93%BE%E4%B8%AD%E6%8C%91%E9%80%89%E5%8F%AF%E8%A7%81%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%8C%E4%BB%8E%E5%9B%BE%E4%B8%AD%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%87%BA%EF%BC%8C%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC%E7%9A%84%E5%88%97name%E7%9A%84%E5%86%85%E5%AE%B9%E6%98%AF'%E8%AF%B8%E8%91%9B%E4%BA%AE'%EF%BC%8C%E8%AF%A5%E7%89%88%E6%9C%AC%E7%9A%84trx_id%E5%80%BC%E4%B8%BA200%EF%BC%8C%E5%9C%A8m_ids%E5%88%97%E8%A1%A8%E5%86%85%EF%BC%8C%E6%89%80%E4%BB%A5%E4%B8%8D%E7%AC%A6%E5%90%88%E5%8F%AF%E8%A7%81%E6%80%A7%E8%A6%81%E6%B1%82%EF%BC%8C%E6%A0%B9%E6%8D%AEroll_pointer%E8%B7%B3%E5%88%B0%E4%B8%8B%E4%B8%80%E4%B8%AA%E7%89%88%E6%9C%AC%EF%BC%9B%0A*%20%E4%B8%8B%E4%B8%80%E4%B8%AA%E7%89%88%E6%9C%AC%E7%9A%84%E5%88%97name%E7%9A%84%E5%86%85%E5%AE%B9%E6%98%AF'%E8%B5%B5%E4%BA%91'%EF%BC%8C%E8%AF%A5%E7%89%88%E6%9C%AC%E7%9A%84trx_id%E5%80%BC%E4%B8%BA200%EF%BC%8C%E4%B9%9F%E5%9C%A8m_ids%E5%88%97%E8%A1%A8%E5%86%85%EF%BC%8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%AF%A2%E8%A1%A8hero%E4%B8%ADnumber%E5%80%BC%E4%B8%BA1%E7%9A%84%E8%AE%B0%E5%BD%95%E6%97%B6%EF%BC%8C%E5%BE%97%E5%88%B0%E7%9A%84%E7%BB%93%E6%9E%9C%E5%B0%B1%E6%98%AF'%E8%AF%B8%E8%91%9B%E4%BA%AE'%E4%BA%86%EF%BC%8C%E5%85%B7%E4%BD%93%E6%B5%81%E7%A8%8B%E6%88%91%E4%BB%AC%E5%B0%B1%E4%B8%8D%E5%88%86%E6%9E%90%E4%BA%86%E3%80%82%E6%80%BB%E7%BB%93%E4%B8%80%E4%B8%8B%E5%B0%B1%E6%98%AF%EF%BC%9A**%E4%BD%BF%E7%94%A8READ%20COMMITTED%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E7%9A%84%E4%BA%8B%E5%8A%A1%E5%9C%A8%E6%AF%8F%E6%AC%A1%E6%9F%A5%E8%AF%A2%E5%BC%80%E5%A7%8B%E6%97%B6%E9%83%BD%E4%BC%9A%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AA%E7%8B%AC%E7%AB%8B%E7%9A%84ReadView**%E3%80%82%0A%0A%23%23%23%23%202-2-1%20Repeatable%20Read%20%E5%9C%A8%E7%AC%AC%E4%B8%80%E6%AC%A1%E8%AF%BB%E5%8F%96%E6%95%B0%E6%8D%AE%E6%97%B6%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AAReadView%0A%0A%0A**%E5%AF%B9%E4%BA%8E%E4%BD%BF%E7%94%A8REPEATABLE%20READ%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E7%9A%84%E4%BA%8B%E5%8A%A1%E6%9D%A5%E8%AF%B4%EF%BC%8C%E5%8F%AA%E4%BC%9A%E5%9C%A8%E7%AC%AC%E4%B8%80%E6%AC%A1%E6%89%A7%E8%A1%8C%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%E6%97%B6%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AAReadView%EF%BC%8C%E4%B9%8B%E5%90%8E%E7%9A%84%E6%9F%A5%E8%AF%A2%E5%B0%B1%E4%B8%8D%E4%BC%9A%E9%87%8D%E5%A4%8D%E7%94%9F%E6%88%90%E4%BA%86**%E3%80%82%0A%0A%0A%E6%AF%94%E6%96%B9%E8%AF%B4%E7%8E%B0%E5%9C%A8%E7%B3%BB%E7%BB%9F%E9%87%8C%E6%9C%89%E4%B8%A4%E4%B8%AA%E4%BA%8B%E5%8A%A1id%E5%88%86%E5%88%AB%E4%B8%BA100%E3%80%81200%E7%9A%84%E4%BA%8B%E5%8A%A1%E5%9C%A8%E6%89%A7%E8%A1%8C%EF%BC%9A%0A!%5B719b63f71f204967a950501d6de734a5.png%5D(en-resource%3A%2F%2Fdatabase%2F1137%3A1)%0A%0A%E6%AD%A4%E5%88%BB%EF%BC%8C%E8%A1%A8hero%E4%B8%ADnumber%E4%B8%BA1%E7%9A%84%E8%AE%B0%E5%BD%95%E5%BE%97%E5%88%B0%E7%9A%84%E7%89%88%E6%9C%AC%E9%93%BE%E8%A1%A8%E5%A6%82%E4%B8%8B%E6%89%80%E7%A4%BA%EF%BC%9A%0A!%5B546931ba9d89ad0d3c5ae6bd4f493f0c.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1139%3A1)%0A%0A%0A%E5%81%87%E8%AE%BE%E7%8E%B0%E5%9C%A8%E6%9C%89%E4%B8%80%E4%B8%AA%E4%BD%BF%E7%94%A8**REPEATABLE%20READ**%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E7%9A%84%E4%BA%8B%E5%8A%A1%E5%BC%80%E5%A7%8B%E6%89%A7%E8%A1%8C%EF%BC%9A%0A!%5Bb2748a037fe3b1a08aa2e65eb4f78a27.png%5D(en-resource%3A%2F%2Fdatabase%2F1141%3A1)%0A%0A%E8%BF%99%E4%B8%AASELECT1%E7%9A%84%E6%89%A7%E8%A1%8C%E8%BF%87%E7%A8%8B%E5%A6%82%E4%B8%8B%EF%BC%9A%0A%0A*%20%E5%9C%A8%E6%89%A7%E8%A1%8CSELECT%E8%AF%AD%E5%8F%A5%E6%97%B6%E4%BC%9A%E5%85%88%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AAReadView%EF%BC%8CReadView%E7%9A%84m_ids%E5%88%97%E8%A1%A8%E7%9A%84%E5%86%85%E5%AE%B9%E5%B0%B1%E6%98%AF%5B100%2C%20200%5D%EF%BC%8Cmin_trx_id%E4%B8%BA100%EF%BC%8Cmax_trx_id%E4%B8%BA201%EF%BC%8Ccreator_trx_id%E4%B8%BA0%EF%BC%9B%0A*%20%E7%84%B6%E5%90%8E%E4%BB%8E%E7%89%88%E6%9C%AC%E9%93%BE%E4%B8%AD%E6%8C%91%E9%80%89%E5%8F%AF%E8%A7%81%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%8C%E4%BB%8E%E5%9B%BE%E4%B8%AD%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%87%BA%EF%BC%8C%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC%E7%9A%84%E5%88%97name%E7%9A%84%E5%86%85%E5%AE%B9%E6%98%AF'%E5%BC%A0%E9%A3%9E'%EF%BC%8C%E8%AF%A5%E7%89%88%E6%9C%AC%E7%9A%84trx_id%E5%80%BC%E4%B8%BA100%EF%BC%8C%E5%9C%A8m_ids%E5%88%97%E8%A1%A8%E5%86%85%EF%BC%8C%E6%89%80%E4%BB%A5%E4%B8%8D%E7%AC%A6%E5%90%88%E5%8F%AF%E8%A7%81%E6%80%A7%E8%A6%81%E6%B1%82%EF%BC%8C%E6%A0%B9%E6%8D%AEroll_pointer%E8%B7%B3%E5%88%B0%E4%B8%8B%E4%B8%80%E4%B8%AA%E7%89%88%E6%9C%AC%EF%BC%9B%0A*%20%E4%B8%8B%E4%B8%80%E4%B8%AA%E7%89%88%E6%9C%AC%E7%9A%84%E5%88%97name%E7%9A%84%E5%86%85%E5%AE%B9%E6%98%AF'%E5%85%B3%E7%BE%BD'%EF%BC%8C%E8%AF%A5%E7%89%88%E6%9C%AC%E7%9A%84trx_id%E5%80%BC%E4%B9%9F%E4%B8%BA100%EF%BC%8C%E4%B9%9F%E5%9C%A8m_ids%E5%88%97%E8%A1%A8%E5%86%85%EF%BC%8C%E6%89%80%E4%BB%A5%E4%B9%9F%E4%B8%8D%E7%AC%A6%E5%90%88%E8%A6%81%E6%B1%82%EF%BC%8C%E7%BB%A7%E7%BB%AD%E8%B7%B3%E5%88%B0%E4%B8%8B%E4%B8%80%E4%B8%AA%E7%89%88%E6%9C%AC%EF%BC%9B%0A*%20%E4%B8%8B%E4%B8%80%E4%B8%AA%E7%89%88%E6%9C%AC%E7%9A%84%E5%88%97name%E7%9A%84%E5%86%85%E5%AE%B9%E6%98%AF'%E5%88%98%E5%A4%87'%EF%BC%8C%E8%AF%A5%E7%89%88%E6%9C%AC%E7%9A%84trx_id%E5%80%BC%E4%B8%BA80%EF%BC%8C%E5%B0%8F%E4%BA%8EReadView%E4%B8%AD%E7%9A%84min_trx_id%E5%80%BC100%EF%BC%8C%E6%89%80%E4%BB%A5%E8%BF%99%E4%B8%AA%E7%89%88%E6%9C%AC%E6%98%AF%E7%AC%A6%E5%90%88%E8%A6%81%E6%B1%82%E7%9A%84%EF%BC%8C%E6%9C%80%E5%90%8E%E8%BF%94%E5%9B%9E%E7%BB%99%E7%94%A8%E6%88%B7%E7%9A%84%E7%89%88%E6%9C%AC%E5%B0%B1%E6%98%AF%E8%BF%99%E6%9D%A1%E5%88%97name%E4%B8%BA'%E5%88%98%E5%A4%87'%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%9B%0A%0A%0A%E4%B9%8B%E5%90%8E%EF%BC%8C%E6%88%91%E4%BB%AC%E6%8A%8A%E4%BA%8B%E5%8A%A1id%E4%B8%BA100%E7%9A%84%E4%BA%8B%E5%8A%A1%E6%8F%90%E4%BA%A4%E4%B8%80%E4%B8%8B%EF%BC%8C%E5%B0%B1%E5%83%8F%E8%BF%99%E6%A0%B7%EF%BC%9A%0A!%5Bc8c4edd0c564dae702813fb4fea92d05.png%5D(en-resource%3A%2F%2Fdatabase%2F1143%3A1)%0A%0A%E7%84%B6%E5%90%8E%E5%86%8D%E5%88%B0%E4%BA%8B%E5%8A%A1id%E4%B8%BA200%E7%9A%84%E4%BA%8B%E5%8A%A1%E4%B8%AD%E6%9B%B4%E6%96%B0%E4%B8%80%E4%B8%8B%E8%A1%A8hero%E4%B8%ADnumber%E4%B8%BA1%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%9A%0A!%5Beec0046b766e4e14742eef73080f53b1.png%5D(en-resource%3A%2F%2Fdatabase%2F1145%3A1)%0A%0A%E6%AD%A4%E5%88%BB%EF%BC%8C%E8%A1%A8hero%E4%B8%ADnumber%E4%B8%BA1%E7%9A%84%E8%AE%B0%E5%BD%95%E7%9A%84%E7%89%88%E6%9C%AC%E9%93%BE%E5%B0%B1%E9%95%BF%E8%BF%99%E6%A0%B7%EF%BC%9A%0A!%5Bef46be4e5b7e5790653a60e49542ff4d.jpeg%5D(en-resource%3A%2F%2Fdatabase%2F1147%3A1)%0A%0A%0A%E7%84%B6%E5%90%8E%E5%86%8D%E5%88%B0%E5%88%9A%E6%89%8D%E4%BD%BF%E7%94%A8REPEATABLE%20READ%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E7%9A%84%E4%BA%8B%E5%8A%A1%E4%B8%AD%E7%BB%A7%E7%BB%AD%E6%9F%A5%E6%89%BE%E8%BF%99%E4%B8%AAnumber%E4%B8%BA1%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%8C%E5%A6%82%E4%B8%8B%EF%BC%9A%0A!%5B5440c9ee1bf4e989ed7d05769e6768cd.png%5D(en-resource%3A%2F%2Fdatabase%2F1149%3A1)%0A%0A%E8%BF%99%E4%B8%AASELECT2%E7%9A%84%E6%89%A7%E8%A1%8C%E8%BF%87%E7%A8%8B%E5%A6%82%E4%B8%8B%EF%BC%9A%0A%0A*%20%E5%9B%A0%E4%B8%BA%E5%BD%93%E5%89%8D%E4%BA%8B%E5%8A%A1%E7%9A%84%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%B8%BAREPEATABLE%20READ%EF%BC%8C%E8%80%8C%E4%B9%8B%E5%89%8D%E5%9C%A8%E6%89%A7%E8%A1%8CSELECT1%E6%97%B6%E5%B7%B2%E7%BB%8F%E7%94%9F%E6%88%90%E8%BF%87ReadView%E4%BA%86%EF%BC%8C%E6%89%80%E4%BB%A5%E6%AD%A4%E6%97%B6%E7%9B%B4%E6%8E%A5%E5%A4%8D%E7%94%A8%E4%B9%8B%E5%89%8D%E7%9A%84ReadView%EF%BC%8C%E4%B9%8B%E5%89%8D%E7%9A%84ReadView%E7%9A%84m_ids%E5%88%97%E8%A1%A8%E7%9A%84%E5%86%85%E5%AE%B9%E5%B0%B1%E6%98%AF%5B100%2C%20200%5D%EF%BC%8Cmin_trx_id%E4%B8%BA100%EF%BC%8Cmax_trx_id%E4%B8%BA201%EF%BC%8Ccreator_trx_id%E4%B8%BA0%EF%BC%9B%0A*%20%E7%84%B6%E5%90%8E%E4%BB%8E%E7%89%88%E6%9C%AC%E9%93%BE%E4%B8%AD%E6%8C%91%E9%80%89%E5%8F%AF%E8%A7%81%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%8C%E4%BB%8E%E5%9B%BE%E4%B8%AD%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%87%BA%EF%BC%8C%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC%E7%9A%84%E5%88%97name%E7%9A%84%E5%86%85%E5%AE%B9%E6%98%AF'%E8%AF%B8%E8%91%9B%E4%BA%AE'%EF%BC%8C%E8%AF%A5%E7%89%88%E6%9C%AC%E7%9A%84trx_id%E5%80%BC%E4%B8%BA200%EF%BC%8C%E5%9C%A8m_ids%E5%88%97%E8%A1%A8%E5%86%85%EF%BC%8C%E6%89%80%E4%BB%A5%E4%B8%8D%E7%AC%A6%E5%90%88%E5%8F%AF%E8%A7%81%E6%80%A7%E8%A6%81%E6%B1%82%EF%BC%8C%E6%A0%B9%E6%8D%AEroll_pointer%E8%B7%B3%E5%88%B0%E4%B8%8B%E4%B8%80%E4%B8%AA%E7%89%88%E6%9C%AC%EF%BC%9B%0A*%20%E4%B8%8B%E4%B8%80%E4%B8%AA%E7%89%88%E6%9C%AC%E7%9A%84%E5%88%97name%E7%9A%84%E5%86%85%E5%AE%B9%E6%98%AF'%E8%B5%B5%E4%BA%91'%EF%BC%8C%E8%AF%A5%E7%89%88%E6%9C%AC%E7%9A%84trx_id%E5%80%BC%E4%B8%BA200%EF%BC%8C%E4%B9%9F%E5%9C%A8m_ids%E5%88%97%E8%A1%A8%E5%86%85%EF%BC%8C%E6%89%80%E4%BB%A5%E4%B9%9F%E4%B8%8D%E7%AC%A6%E5%90%88%E8%A6%81%E6%B1%82%EF%BC%8C%E7%BB%A7%E7%BB%AD%E8%B7%B3%E5%88%B0%E4%B8%8B%E4%B8%80%E4%B8%AA%E7%89%88%E6%9C%AC%EF%BC%9B%0A*%20%E4%B8%8B%E4%B8%80%E4%B8%AA%E7%89%88%E6%9C%AC%E7%9A%84%E5%88%97name%E7%9A%84%E5%86%85%E5%AE%B9%E6%98%AF'%E5%BC%A0%E9%A3%9E'%EF%BC%8C%E8%AF%A5%E7%89%88%E6%9C%AC%E7%9A%84trx_id%E5%80%BC%E4%B8%BA100%EF%BC%8C%E8%80%8Cm_ids%E5%88%97%E8%A1%A8%E4%B8%AD%E6%98%AF%E5%8C%85%E5%90%AB%E5%80%BC%E4%B8%BA100%E7%9A%84%E4%BA%8B%E5%8A%A1id%E7%9A%84%EF%BC%8C%E6%89%80%E4%BB%A5%E8%AF%A5%E7%89%88%E6%9C%AC%E4%B9%9F%E4%B8%8D%E7%AC%A6%E5%90%88%E8%A6%81%E6%B1%82%EF%BC%8C%E5%90%8C%E7%90%86%E4%B8%8B%E4%B8%80%E4%B8%AA%E5%88%97name%E7%9A%84%E5%86%85%E5%AE%B9%E6%98%AF'%E5%85%B3%E7%BE%BD'%E7%9A%84%E7%89%88%E6%9C%AC%E4%B9%9F%E4%B8%8D%E7%AC%A6%E5%90%88%E8%A6%81%E6%B1%82%E3%80%82%E7%BB%A7%E7%BB%AD%E8%B7%B3%E5%88%B0%E4%B8%8B%E4%B8%80%E4%B8%AA%E7%89%88%E6%9C%AC%EF%BC%9B%0A*%20%E4%B8%8B%E4%B8%80%E4%B8%AA%E7%89%88%E6%9C%AC%E7%9A%84%E5%88%97name%E7%9A%84%E5%86%85%E5%AE%B9%E6%98%AF'%E5%88%98%E5%A4%87'%EF%BC%8C%E8%AF%A5%E7%89%88%E6%9C%AC%E7%9A%84trx_id%E5%80%BC%E4%B8%BA80%EF%BC%8C%E5%B0%8F%E4%BA%8EReadView%E4%B8%AD%E7%9A%84min_trx_id%E5%80%BC100%EF%BC%8C%E6%89%80%E4%BB%A5%E8%BF%99%E4%B8%AA%E7%89%88%E6%9C%AC%E6%98%AF%E7%AC%A6%E5%90%88%E8%A6%81%E6%B1%82%E7%9A%84%EF%BC%8C%E6%9C%80%E5%90%8E%E8%BF%94%E5%9B%9E%E7%BB%99%E7%94%A8%E6%88%B7%E7%9A%84%E7%89%88%E6%9C%AC%E5%B0%B1%E6%98%AF%E8%BF%99%E6%9D%A1%E5%88%97c%E4%B8%BA'%E5%88%98%E5%A4%87'%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%9B%0A%0A%E4%B9%9F%E5%B0%B1%E6%98%AF%E8%AF%B4%E4%B8%A4%E6%AC%A1SELECT%E6%9F%A5%E8%AF%A2%E5%BE%97%E5%88%B0%E7%9A%84%E7%BB%93%E6%9E%9C%E6%98%AF%E9%87%8D%E5%A4%8D%E7%9A%84%EF%BC%8C%E8%AE%B0%E5%BD%95%E7%9A%84%E5%88%97c%E5%80%BC%E9%83%BD%E6%98%AF'%E5%88%98%E5%A4%87'%EF%BC%8C%E8%BF%99%E5%B0%B1%E6%98%AF**%E5%8F%AF%E9%87%8D%E5%A4%8D%E8%AF%BB**%E7%9A%84%E5%90%AB%E4%B9%89%E3%80%82%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E4%B9%8B%E5%90%8E%E5%86%8D%E6%8A%8A%E4%BA%8B%E5%8A%A1id%E4%B8%BA200%E7%9A%84%E8%AE%B0%E5%BD%95%E6%8F%90%E4%BA%A4%E4%BA%86%EF%BC%8C%E7%84%B6%E5%90%8E%E5%86%8D%E5%88%B0%E5%88%9A%E6%89%8D%E4%BD%BF%E7%94%A8REPEATABLE%20READ%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E7%9A%84%E4%BA%8B%E5%8A%A1%E4%B8%AD%E7%BB%A7%E7%BB%AD%E6%9F%A5%E6%89%BE%E8%BF%99%E4%B8%AAnumber%E4%B8%BA1%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%8C%E5%BE%97%E5%88%B0%E7%9A%84%E7%BB%93%E6%9E%9C%E8%BF%98%E6%98%AF'%E5%88%98%E5%A4%87'%EF%BC%8C%E5%85%B7%E4%BD%93%E6%89%A7%E8%A1%8C%E8%BF%87%E7%A8%8B%E5%A4%A7%E5%AE%B6%E5%8F%AF%E4%BB%A5%E8%87%AA%E5%B7%B1%E5%88%86%E6%9E%90%E4%B8%80%E4%B8%8B%E3%80%82%0A%0A%23%23%23%202-3%20MVCC%E5%B0%8F%E7%BB%93%0A%0A%E4%BB%8E%E4%B8%8A%E8%BE%B9%E7%9A%84%E6%8F%8F%E8%BF%B0%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%87%BA%EF%BC%8CMySQL%E4%B8%AD**MVCC%EF%BC%8CMulti-Version%20Concurrency%20Control%20%EF%BC%8C%E5%A4%9A%E7%89%88%E6%9C%AC%E5%B9%B6%E5%8F%91%E6%8E%A7%E5%88%B6**%E5%AE%9E%E7%8E%B0%E5%8E%9F%E7%90%86%E5%A6%82%E4%B8%8B%EF%BC%9A%0A%0A*%20read%20uncommitted%EF%BC%9A%E8%AF%BB%E5%8F%96%E7%89%88%E6%9C%AC%E9%93%BE%E4%B8%AD%E6%9C%80%E6%96%B0%E7%9A%84%E6%95%B0%E6%8D%AE%EF%BC%9B%0A*%20read%20committed%EF%BC%9A%E9%80%9A%E8%BF%87%E7%89%88%E6%9C%AC%E9%93%BE%E5%92%8CReadView%E6%89%BE%E5%88%B0%E5%8F%AF%E8%AF%BB%E7%89%88%E6%9C%AC%EF%BC%9B%0A*%20repeatable%20read%EF%BC%9A%E9%80%9A%E8%BF%87%E7%89%88%E6%9C%AC%E9%93%BE%E5%92%8CReadView%E6%89%BE%E5%88%B0%E5%8F%AF%E8%AF%BB%E7%89%88%E6%9C%AC%EF%BC%9B%0A*%20serializable%EF%BC%9A%E9%80%9A%E8%BF%87%E9%94%81%E6%9C%BA%E5%88%B6%E5%AE%9E%E7%8E%B0%E4%B8%B2%E8%A1%8C%E5%8C%96%E3%80%82%0A%0A%0Aread%20committed%E3%80%81repeatable%20read%E8%BF%99%E4%B8%A4%E4%B8%AA%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E7%9A%84%E4%B8%80%E4%B8%AA%E5%BE%88%E5%A4%A7%E4%B8%8D%E5%90%8C%E5%B0%B1%E6%98%AF%EF%BC%9A%E7%94%9F%E6%88%90ReadView%E7%9A%84%E6%97%B6%E6%9C%BA%E4%B8%8D%E5%90%8C%E3%80%82%0A%0A*%20read%20committed%E5%9C%A8%E6%AF%8F%E4%B8%80%E6%AC%A1%E8%BF%9B%E8%A1%8C%E6%99%AE%E9%80%9Aselect%E6%93%8D%E4%BD%9C%E5%89%8D%E9%83%BD%E4%BC%9A%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AAReadView%EF%BC%9B%0A*%20repeatable%20read%E5%8F%AA%E5%9C%A8%E7%AC%AC%E4%B8%80%E6%AC%A1%E8%BF%9B%E8%A1%8C%E6%99%AE%E9%80%9ASELECT%E6%93%8D%E4%BD%9C%E5%89%8D%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AAReadView%EF%BC%8C%E4%B9%8B%E5%90%8E%E7%9A%84%E6%9F%A5%E8%AF%A2%E6%93%8D%E4%BD%9C%E9%83%BD%E9%87%8D%E5%A4%8D%E4%BD%BF%E7%94%A8%E8%BF%99%E4%B8%AAReadView%E5%B0%B1%E5%A5%BD%E4%BA%86%E3%80%82%0A%0A!%5B51606a1460e82239e3db57931300ac98.png%5D(en-resource%3A%2F%2Fdatabase%2F1151%3A1)%0A%0A%23%23%23%202-4%20%E5%85%B3%E4%BA%8Epurge%0A%0A*%20insert%20undo%E5%9C%A8%E4%BA%8B%E5%8A%A1%E6%8F%90%E4%BA%A4%E4%B9%8B%E5%90%8E%E5%B0%B1%E5%8F%AF%E4%BB%A5%E8%A2%AB%E9%87%8A%E6%94%BE%E6%8E%89%E4%BA%86%EF%BC%8C%E8%80%8Cupdate%20undo%E7%94%B1%E4%BA%8E%E8%BF%98%E9%9C%80%E8%A6%81%E6%94%AF%E6%8C%81MVCC%EF%BC%8C%E4%B8%8D%E8%83%BD%E7%AB%8B%E5%8D%B3%E5%88%A0%E9%99%A4%E6%8E%89%EF%BC%9B%0A*%20%E4%B8%BA%E4%BA%86%E6%94%AF%E6%8C%81MVCC%EF%BC%8C%E5%AF%B9%E4%BA%8Edelete%20mark%E6%93%8D%E4%BD%9C%E6%9D%A5%E8%AF%B4%EF%BC%8C%E4%BB%85%E4%BB%85%E6%98%AF%E5%9C%A8%E8%AE%B0%E5%BD%95%E4%B8%8A%E6%89%93%E4%B8%80%E4%B8%AA%E5%88%A0%E9%99%A4%E6%A0%87%E8%AE%B0%EF%BC%8C%E5%B9%B6%E6%B2%A1%E6%9C%89%E7%9C%9F%E6%AD%A3%E5%B0%86%E5%AE%83%E5%88%A0%E9%99%A4%E6%8E%89%EF%BC%9B%0A%0A%E9%9A%8F%E7%9D%80%E7%B3%BB%E7%BB%9F%E7%9A%84%E8%BF%90%E8%A1%8C%EF%BC%8C%E5%9C%A8%E7%A1%AE%E5%AE%9A%E7%B3%BB%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9A%84%E6%97%B6%E9%97%B4%E6%9D%A5%E8%BF%87%E6%BB%A4%E6%8E%89%E4%B8%80%E4%BA%9B%E8%A1%8C%2C%E6%89%8D%E8%83%BD%E5%BE%97%E5%87%BA%E7%BB%93%E6%9E%9C%2C%E5%BF%85%E7%84%B6%E8%A6%81%E6%89%A7%E8%A1%8C%E5%85%A8%E8%A1%A8%E6%89%AB%E6%8F%8F%2C%E8%80%8C%E5%85%A8%E8%A1%A8%E6%89%AB%E6%8F%8F%E6%98%AF%E9%9D%9E%E5%B8%B8%E8%80%97%E6%97%B6%E7%9A%84.%E5%AF%B9%E4%BA%8Emyisam%E7%9A%84%E8%A1%A8%2C%E4%BB%BB%E4%BD%95%E8%A1%8C%E9%83%BD%E5%8F%AA%E6%9C%89%E4%B8%80%E4%B8%AA%E7%89%88%E6%9C%AC%2Cmysql%E7%94%9A%E8%87%B3%E4%B8%8D%E9%9C%80%E8%A6%81%E6%89%AB%E6%8F%8F%E5%B0%B1%E5%8F%AF%E4%BB%A5%E7%9B%B4%E6%8E%A5%E8%BF%94%E5%9B%9E%E7%B2%BE%E7%A1%AE%E7%9A%84%E7%BB%9F%E8%AE%A1%E7%BB%93%E6%9E%9C%2C%E6%88%91%E4%BB%AC%E7%94%A8explain%E4%B9%9F%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%88%B0%2C%E5%AF%B9%E4%BA%8Emyisam%E7%9A%84%E8%A1%A8%2C%E6%89%A7%E8%A1%8Cselect%20count(*)%E7%9A%84%E6%97%B6%E5%80%99%2Cmysql%E6%98%BE%E7%A4%BA%E2%80%9D%C2%A0Select%20tables%20optimized%20away%E2%80%9D%2C%E6%9F%A5%E8%AF%A2%E7%9B%B4%E6%8E%A5%E8%A2%AB%E4%BC%98%E5%8C%96%E4%BA%86%3B%E8%80%8C%E5%AF%B9%E4%BA%8Einnodb%E7%9A%84%E8%A1%A8%2C%E5%8F%AF%E8%83%BD%E6%98%AF%E5%85%A8%E8%A1%A8%E6%89%AB%E6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%A4%E6%97%B6%E9%80%82%E5%90%88%E9%80%89%E7%94%A8char%E7%9A%84%E5%88%97%2C%E8%80%8C%E5%AF%B9%E4%BA%8E%E8%A1%A8%E4%B8%AD%E7%9A%84%E5%8F%98%E9%95%BF%E7%9A%84%E5%88%97%2C%E5%8F%AF%E4%BB%A5%E9%87%87%E7%94%A8%E5%88%86%E8%A1%A8%E7%9A%84%E6%96%B9%E6%B3%95%E6%8A%8A%E5%8F%98%E9%95%BF%E7%9A%84%E5%88%97%E6%8B%86%E5%88%86%E5%87%BA%E5%8E%BB%2C%E6%8F%90%E9%AB%98%E5%AE%9A%E9%95%BF%E8%A1%A8%E7%9A%84%E6%A3%80%E7%B4%A2%E6%80%A7%E8%83%BD.%E8%80%8C%E5%A6%82%E6%9E%9C%E4%BD%BF%E7%94%A8%E7%9A%84%E6%98%AFinnodb%E7%9A%84%E5%BC%95%E6%93%8E%2C%E7%94%B1%E4%BA%8Einnodb%E7%9A%84mvcc%E7%AD%96%E7%95%A5%E7%9A%84%E5%AE%9E%E6%96%BD%2Cchar%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B%E7%9B%B8%E5%AF%B9%E4%BA%8Evarchar%E7%B1%BB%E5%9E%8B%E5%87%A0%E4%B9%8E%E6%B2%A1%E6%9C%89%E4%BB%BB%E4%BD%95%E4%BC%98%E5%8A%BF%2C%E5%8F%8D%E8%80%8Cvarchar%E5%88%97%E5%8F%AF%E8%83%BD%E8%8A%82%E7%9C%81%E6%9B%B4%E5%A4%9A%E7%9A%84%E5%AD%98%E5%82%A8%E7%A9%BA%E9%97%B4%2C%E5%BB%BA%E8%AE%AE%E4%BD%BF%E7%94%A8varchar%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B.</center></span>
</div></body></html> 